<!-- /*
 * @Author: 俞明月
 * @Date:   2022-01-30
 * @Last Modified by:   俞明月
 * @Last Modified time: 2022-01-30
 */ -->
<template>
	<div class="ui-mode-container ui-mode-box flex-col">
        <div class="ui-header-item gradient">
            <div class="ui-header-arraw prev" @click="handleHistory" @touchstart.stop>
                <i class="iconfont icon iconjiantou-zuo-cuxiantiao"></i>
            </div>
            <div class="ui-header-title">浏览记录</div>
            <div class="ui-header-arraw next flex-row align-center" @touchstart.stop @click="handleHome">
                <i class="iconfont icon iconi-home"></i>
            </div>
        </div>
        <div class="ui-mode-content flex1" ref="scrollPage" v-if="pageStatus">
            <div class="relative" v-if="list&&list.length">
                <div class="history-item"
                    :key="`chat-${item.id_public_middle_table}-${i}`"
                    v-for="(item,i) in list">
                    <div class="flex-row align-center-row align-between-row">
                        <div>浏览时间</div>
                        <div>{{item.time_insert}}</div>
                    </div>
                    <div class="flex-row align-center-row align-between-row">
                        <div>商品名称</div>
                        <div>{{item.mid_table_remark_003}}</div>
                    </div>
                </div>
            </div>
        </div>
    </div>
</template>
<script>
import mixinCommon from '@/views/content/mixins/common';
import mixinRequest from '@/views/content/mixins/request';
export default {
    name: 'my/history',
    data() {
        return {
            public_agent_info:{},
            public_user_info:{},
            list:[]
        }
    },
    mixins:[
        mixinCommon,
        mixinRequest,
    ],
    computed:{
    },
    watch:{
        resourceLoaded:{
            handler(flag){
                flag&&this.$nextTick(this.init); 
            },
            immediate:true
        }
    },
    created(){
    },
    mounted(){
    },
    methods:{
        /*
         * 初始化
         */
        init(){
            this.getShopInfo().then(({result,response})=>{
                this.getPageInfo({
                    name:'common.collect',
                    param:{
                        invoke_method:'public_load_middle_table_list',
                        pre_db_para_middle_table_name:'public_middle_table_search_msg',
                        type_middle_app:80001,
                        type_inner_app:1001,
                        pre_db_para_begin_idx:0,
                        pre_db_para_length_4_list:1000,
                        id_public_user_info:this.public_user_info.id_public_user_info,
                        pre_db_para_order_by_para: ' time_insert desc '
                    }
                }).then(({result,response})=>{
                    this.list=result.page_content;
                });
            }).catch(({msg})=>{
                this.showResult(msg,true);
            });
        },
        getShopInfo(){
            return new Promise((resolve,reject)=>{
                this.$http.post({
                    name:'common.shop.info',
                    data:{
                        invoke_method:'user_and_shop_info'
                    },
                    loading:{
                        enabled:false
                    }
                }).then(({result,response})=>{
                    this.public_agent_info=result.public_agent_info||{};
                    this.public_user_info=result.public_user_info||{};
                    this.setState({
                        key:'public_agent_info',
                        value:this.public_agent_info
                    });
                    this.setState({
                        key:'public_user_info',
                        value:this.public_user_info
                    });
                    resolve({result,response});
                }).catch(({msg})=>{
                    reject({msg});
                });
            });
        },
    },
    components:{
    },
    beforeDestroy(){
    }
}
</script>
<style lang="less" scoped>
.history-item{
    margin-top:.32rem;
    padding:.85rem;
    background-color:#FFF;
    line-height:1.8em;
    font-size:.75rem;
}
</style>